﻿<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">Upload reference</h3>
</div>
<div class="modal-body">
    <div>
        <input type="file" name="fileData" id="file_upload" />
    </div>

    <hr />

    <div id="filecontent">
        Added Images:
    </div>

    <input class="btn btn-primary" type="button" id="upload" value="Upload selected file" />
</div>
<div class="modal-footer">
    <button class="btn close-modal" id="btn-close-add-reference" data-dismiss="modal" aria-hidden="true">Close</button>
</div>

<script type="text/javascript">
    $('#filecontent').hide();
    $('#file_upload').uploadify({
        'swf': '@Url.Content("~/Scripts/Uploadify/uploadify.swf")',
        'uploader': '@Url.Action("TenantUploadReference", "Tenants")',
        'auto': false,
        'multi': true,
        'buttonText': 'Browse',
        'fileTypeExts': '*.jpg;*.jpeg;*.png;',
        'removeCompleted': false,
        'onSelect': function (file) {
            $("#selectimage").click(function () {
                $("#file_upload-queue").appendTo("#filecontent");
            });
        },
        'onUploadComplete': function () {
            $('.close-modal').click(function () {
                location.reload(true);
            });
            return false;
        }
    });

    $('#upload').click(function () {
        $('#file_upload').uploadify('upload', '*');
        return false;
    });
</script>

